<div ng-include src="'views/sidebar.html'"></div>
<div id="page-wrapper" ng-init="init()">
    <br>
    <div class="page-header-sm">
        <h1>
        自定义HTML模块
          <div class="btn-group pull-right" role="group" aria-label="fn">
            <button ng-if="isAdd == false" class="btn btn-success" ng-click="save(mainproducts.cmsData[0], $event)">
              <i class="fa fa-floppy-o"></i> 保存
            </button>
            <button ng-if="isAdd == true" class="btn btn-success" ng-click="add(item, $event)">
              <i class="fa fa-floppy-o"></i> 保存
            </button>
            <button class="btn btn-warning" ng-click="revert()">
                <i class="fa fa-undo"></i> 还原
            </button>
            <button class="btn btn-danger" ng-click="publishData()">
              <i class="fa fa-paper-plane"></i> 发布
            </button>
            <a class="btn btn-info" ng-if="pageType==0" href="http://www.tepin.hk/preview/{{pageId}}.html" target="_blank" title="预览"><i class="fa fa-link"></i>预览</a>
            <a class="btn btn-info" ng-if="pageType!=0" href="http://m.tepin.hk/preview/{{pageId}}.html" target="_blank" title="预览"><i class="fa fa-link"></i>预览</a>
            <button class="btn btn-primary" ng-click="viewOnline()">
                <i class="fa fa-link"></i> 浏览线上
            </button>
          </div>
        </h1>
        <small style="color: red">注意:预览确认后不要遗忘发布!
          </small>
    </div>
    <div class="row" ng-if="isAdd == false">
        <div ui-ace="{
          useWrapMode : true,
          showGutter: false,
          theme:'twilight',
          mode: 'xml',
          firstLineNumber: 5,
          onLoad: loaded,
          onChange: changed
        }" ng-model="property.propertyValue" ng-repeat="property in mainproducts.cmsData[0].properties" ng-if="property.propertyName == 'html'">
        </div>
    </div>
    <div class="row" ng-if="isAdd == true">
        <div class="col-sm-12">
            <div class="modal-body" ng-if="item.fieldType == 'Html'">
                <div ui-ace="{
                  useWrapMode : true,
                  showGutter: false,
                  theme:'twilight',
                  mode: 'xml',
                  firstLineNumber: 5,
                  onLoad: loaded,
                  onChange: changed
                }" ng-model="item.propertyValue">
                </div>
            </div>
        </div>
    </div>
</div>
